package com.example.myday1909d.ui;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;


import java.util.ArrayList;

public class VpItAdapter extends FragmentPagerAdapter {
    private final ArrayList<DataBean> mTitles;
    private final ArrayList<Fragment> mFragments;

    public VpItAdapter(FragmentManager fm, ArrayList<DataBean> titles, ArrayList<Fragment> fragments) {
        super(fm);
        mTitles = titles;
        mFragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles.get(position).getName();
    }
}
